package cn.admin.configcenter.registry.service;

import cn.admin.config.common.Revision;
import cn.admin.config.common.protocol.Swizzle;
import cn.admin.configcenter.registry.common.info.ClientConnection;
import cn.admin.configcenter.registry.common.info.GroupId;

import java.util.List;
import java.util.Map;

public interface DataService {

    void addPublisher(ClientConnection client, GroupId group,
                      String clientId, String datumId);

    void publishData(ClientConnection client, String dataId,
                     String clientId, List<Swizzle> data, Revision revision);

    void publishSyncData(ClientConnection client, String dataId, String clientId,
                         List<Swizzle> data, Revision revision, String originalCsIp);

    void addSubscriber(ClientConnection client, GroupId group, String clientId);

    List<Swizzle> getData(GroupId group) throws Exception;

    List<Swizzle> getPushData(GroupId group) throws Exception;

    Map<String,Swizzle> getDatumData(GroupId group) throws Exception;

    List<GroupId> allDataGroups() throws Exception;

    enum DATA_TYPE {
        NON_PERSIST,
        PERSIST,
        BOTH;
    }

}
